package com.parent.feign.client.impl;

import com.parent.feign.client.Main01FeignClient;
import com.parent.feign.demo.DeviceFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * fallback:
 * @author yan
 * @date 2023/4/13 0013 15:26
 */
@Component
@Slf4j
public class Main01FeignClientFallbackFactory implements FallbackFactory<Main01FeignClient> {
    @Override
    public Main01FeignClient create(Throwable throwable) {
        log.error("[Main01FeignClient]服务异常:", throwable);
        return new Main01FeignClient() {
            @Override
            public String nacos() {
                return "服务异常";
            }

//            @Override
//            public SerializableResult<DeviceInfoOutVo> deviceInfo(DeviceOutDto deviceOutDto) {
//                return ResultViewUtil.genErrorSerializableResult(DeviceInfoOutVo.class, Constants.ERRCODE_SERVICE_UNAVAILABLE,Constants.ERRMSG_SERVICE_UNAVAILABLE);
//            }
        };
    }
}
